package com.jinke.api.modules.ums.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jinke.api.modules.app.enums.OrderStatus;
import com.jinke.api.modules.app.enums.OrderType;
import com.jinke.api.modules.app.enums.ValidateStatus;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Arrays;

@Data
public class UNRefundedOrderPageVO {
    @ApiModelProperty("id")
    private Long id;
    @ApiModelProperty("订单号")
    private String orderNo;
    @ApiModelProperty("保证金")
    private BigDecimal earnest;
    @ApiModelProperty("订单状态")
    private Integer status;
    @ApiModelProperty("订单状态描述")
    private String statusDesc;
    @ApiModelProperty("面单创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private LocalDateTime createTime;
    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private LocalDateTime createdAt;
    public String getStatusDesc() {
        return Arrays.stream(OrderStatus.values()).filter(item -> status.equals(item.getValue())).findFirst().orElseThrow(() -> new IllegalArgumentException("Unknown status value: " + status)).getDesc();
    }
}
